<%@ page contentType="text/html; charset=UTF-8"%>
<%@ page import = "java.util.*" %>
<%@ page import = "com.sinodata.bsm.common.vo.Probe" %>
<%@ include file="../include/taglib.jsp"%>

<%
    response.setHeader("Cache-Control", "no-store");
	response.setHeader("Pragrma", "no-cache");
	response.setDateHeader("Expires", 0);
%>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html>
<head>
<title>SNMP测试</title>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<meta http-equiv="pragma" content="no-cache" />
<meta http-equiv="cache-control" content="no-cache" />
<meta http-equiv="expires" content="0" />
<%@ include file="../include/common.jsp"%>

<link rel="stylesheet" type="text/css"
	href="${pageContext.request.contextPath}/style/default/bsm/sub_menu.css" />

<link rel="stylesheet" type="text/css"
	href="${pageContext.request.contextPath}/style/default/bsm/selfmainten/tool.css" />
	
<script type="text/javascript" src="<%=request.getContextPath()%>/scripts/jsframework.js"></script>

	
<script type=text/javascript>
	function doConn(){
		var probe = $('#probeId option:selected').val();
		var version = $('#version option:selected').val();
		 $.ajax({
			   type: "POST", 
			   url: '${pageContext.request.contextPath}/selfmainten/tool!snmpConn.action', //请求的action
			   data: {
				   probeid:probe,
				   ip :$('#ip').val(),
				   port:$('#port').val(),
				   comunity :$('#comunity').val(),
				   version :version,
				   oid :$('#oid').val()
			   },
			   dataType: 'json',
			   success: function(data){ //结果
				   $('#result').val(data.result);
			   }
		});
	}
	
	
	$(function() {
		$('#cmd').bind('keydown', function(event){
			   if (event.keyCode=="13"){
				   docmd();
				   return false;
			   }
		});
		
		$("#choice").live('change',function(){
			var oid = $('#choice option:selected').val();
			$("#oid").val(oid);
		})
	});
</script>
</head>
<body >
	<div class="searchFormStyle search" >
		 <span class="search-span">
  		    <label>&nbsp;&nbsp;采集器：</label>
  		    <select id="probeId" name = "probeId"  class = "select search-input"  >
	    					 <option value="" title=''>---- 请选择采集器 ----</option>
	    					<%
	    						List<Probe> probes = (List<Probe>)request.getAttribute("probeList");
	    						if(probes!=null)
	    						for(Probe  p : probes){
	    						    if(p.getStatus()==3){
	  	    			    				out.println("<option value='"+p.getId()+"' title='/bsm/style/default/bsm/images/proberun.png' >已启_"+p.getId()+"_"+p.getName()+"</option>");
	  	    						    }else{
	  	  	    			    			out.println("<option value='"+p.getId()+"' title='/bsm/style/default/bsm/images/probestop.png' >未启_"+p.getId()+"_"+p.getName()+"</option>");
	  	    						    }
	    						}
	    					%>
	    	</select>
    	 </span>
    	 
   		<span class="search-span">
   		   <label >&nbsp;&nbsp;&nbsp;&nbsp;参考：</label>
   		   <select id="choice" name = "choice"  style="width:200px;" >
  				<option value="1.3.6.1.2.1.1.1.0">系统描述</option>
  				<option value="1.3.6.1.2.1.1.2.0">SysOID</option>
  				<option value="1.3.6.1.2.1.1.5.0">系统名称</option>
  				
  			</select>
	    </span>
	</div>
	
	<div class="searchFormStyle search" >
		<span class="search-span">
  		    <label >&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;IP：</label>
  			<input type="text" id="ip" name="ip" class="search-input" value="127.0.0.1">
  		    
    	</span>
    	
   		<span class="search-span">
   		    <label>&nbsp;&nbsp;&nbsp;&nbsp;端口：</label>
  			<input type="text" id="port" name="port" class="search-input" value="161" >
	    </span>
	</div>
	
	<div class="searchFormStyle search" >
		<span class="search-span">
  		    <label >读团体名：</label>
  			<input type="text" id="comunity" name="comunity" class="search-input" value="public">
    	</span>
    	<span class="search-span">
   		    <label >&nbsp;&nbsp;&nbsp;&nbsp;版本：</label>
  			<select id="version" name = "version"  class="search-input">
  				<option value="1">V1</option>
  				<option value="2">V2C</option>
  				<option value="3">V3</option>
  			</select>
	    </span>
	</div>
	
	<div class="searchFormStyle search" >
		<span class="search-span-cmd">
	 		<label >&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;OID：</label>
  			<input type="text" id="oid" name="oid" style="width:250px;" value="1.3.6.1.2.1.1.1.0">
  			
  			
	 	</span>
	 	<span class="search-span-cmd">
	 		<input type="button" value="Get" class="btn-4 btn-h" onclick="doConn();">
	    </span>
	</div>
	
	<div class="searchFormStyle search" >
		<textarea style="width: 900px;height: 350px;" id="result" name="result"></textarea>
	</div>
</body>
</html>